function! myspacevim#before() abort
    " LanguageClient - rust
    let g:LanguageClient_autoStart = 1

    " LanguageClient - python
    if filereadable(fnamemodify('settings-mspls.json', ':p'))
        let g:LanguageClient_settingsPath=(fnamemodify('settings-mspls.json', ':p'))
    else
        let g:LanguageClient_settingsPath=expand('~/.config/settings-mspls.json')
    endif

    " python
    let g:python3_host_prog = '/usr/bin/python3'
endfunction

function! myspacevim#after() abort
    let g:airline_left_sep=''
    let g:airline_right_sep=''

    " deoplete-go
    let g:deoplete#sources#go#gocode_binary=$GOPATH.'/bin/gocode'
    let g:deoplete#sources#go#sort_class=['package', 'func', 'type', 'var', 'const']

    " LanguageClient
    "let g:LanguageClient_rootMarkers = {
    "\ 'go': ['.git', 'go.mod'],
    "\ }
    "let g:LanguageClient_serverCommands = {
    "\ 'python': ['pyls'],
    "\ 'rust': ['rustup', 'run', 'nightly', 'rls'],
    "\ 'go': [$GOPATH.'/bin/go-langserver', '-format-tool', 'gofmt', '-lint-tool', 'golint'],
    "\ }

    " LanguageClient - key mappings
    nnoremap <space>li :call LanguageClient_textDocument_implementation()<CR>
    nnoremap <space>ld :call LanguageClient#textDocument_definition()<CR>
    nnoremap <space>lr :call LanguageClient#textDocument_rename()<CR>
    nnoremap <space>lf :call LanguageClient#textDocument_formatting()<CR>
    nnoremap <space>lt :call LanguageClient#textDocument_typeDefinition()<CR>
    nnoremap <space>lx :call LanguageClient#textDocument_references()<CR>
    nnoremap <space>la :call LanguageClient_workspace_applyEdit()<CR>
    nnoremap <space>lh :call LanguageClient#textDocument_hover()<CR>
    nnoremap <space>ls :call LanguageClient_textDocument_documentSymbol()<CR>
    nnoremap <space>lc :call LanguageClient_textDocument_codeAction()<CR>
    nnoremap <space>lu :call *LanguageClient#textDocument_documentHighlight()<CR>
    nnoremap <space>lm :call LanguageClient_contextMenu()<CR>
    nnoremap <space>pc :pc<CR> 

    " rust
    let g:autofmt_autosave = 1

    " ale
    let g:ale_sign_error = ''
    let g:ale_sign_warning = ''
    let g:ale_completion_enabled = 1
    let g:ale_echo_msg_error_str = 'E'
    let g:ale_echo_msg_warning_str = 'W'
    let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
    let g:ale_swift_swiftlint_use_defaults = 1
    let g:ale_open_list = 0
    let g:ale_lint_delay = 1000
    let g:ale_linters = {
          \ 'go': ['golint', 'go vet', 'go build'],
          \ }
    nmap ]a <Plug>(ale_next_wrap)
    nmap [a <Plug>(ale_previous_wrap)
endfunction

